package BasicClass.One;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class BasicOne10 {
    public static void main(String[] args) throws IOException {
        BasicOne10 main = new BasicOne10();
        main.Main();
    }

    /**
     * 你需要输入一个n，一个数k，然后输入一个长度为n个大小的数组arr，
     * 然后你需要在arr上找满足>=K的最左位置，并且输出这个位置，如果不存在这个位置就输出-1。
     */
    public void Main() throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] s = reader.readLine().split(" ");
        int size = Integer.parseInt(s[0]);
        int num = Integer.parseInt(s[1]);
        String[] nums = reader.readLine().split(" ");
        int[] ints = new int[size];
        for (int i = 0; i < size; i++) {
            ints[i]=Integer.parseInt(nums[i]);
        }
        if(ints[size-1]<num){
            System.out.println(-1);
            return;
        }
        int left = 0;
        int right = size-1;
        int index = -1;
        while (left<=right){
            int mid = ((right-left)>>1)+left;
            if(ints[mid]>=num){
                right = mid-1;
                index = mid;
            }else {
                left = mid+1;
            }
        }
        System.out.println(index);
    }
}
